package com.five.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("gxa_product")
public class Product implements Serializable {
//aaa
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 商品名称
     */
    @TableField("product_name")
    @NotBlank(message = "商品名称不能为空")
    private String productName;

    /**
     * 当前价格
     */
    @NotNull(message = "价格不能为空")
    @DecimalMin(value = "0.0", inclusive = false, message = "价格必须大于0")
    private BigDecimal price;

    /**
     * 原价
     */
    @TableField("original_price")
    @DecimalMin(value = "0.0", message = "原价不能为负数")
    private BigDecimal originalPrice;

    /**
     * 库存数量
     */
    @TableField("stock_quantity")
    @NotNull(message = "库存数量不能为空")
    private Integer stockQuantity;

    /**
     * 销售数量
     */
    @TableField("sale_quantity")
    private Integer saleQuantity = 0;

    /**
     * 商品状态
     * 0: 下架 1: 上架
     */
    @TableField("product_status")
    private Integer productStatus = 1;

    /**
     * 首图
     */
    @TableField("image")
    private String image;

    /**
     * 分类ID
     */
    @TableField("category_id")
    @NotNull(message = "分类ID不能为空")
    private Long categoryId;

    /**
     * 品牌ID
     */
    @TableField("brand_id")
    @NotNull(message = "品牌ID不能为空")
    private Long brandId;

    /**
     * 商品描述
     */
    private String description;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime = LocalDateTime.now();

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime = LocalDateTime.now();

    //服务
    private String service;

    private Integer version;
}

